import AxiosInterceptorManager from './AxiosInterceptorManager';

export type Methods = 'GET' | 'get' | 'POST' | 'post' | 'PUT' | 'put' | 'DELETE' | 'delete';
 
export interface AxiosRequestConfig{
    url?: string;
    method?: Methods;
    timeout?: number;
    params?: any;
    cancelToken?: Promise<any>;
    headers?: Record<string, any>;
    data?: Record<string, any>;
    transformRequest?: (data: any, headers: any) => any;
    transformResponse?: (data: any) => any;
}

export interface AxiosResponse<T=any>{
    data: T,
    status: number,
    statusText: string,
    headers: any,
    config: AxiosRequestConfig,
    request: any,
}

export interface AxiosInstance{
    <T=any>(config: AxiosRequestConfig): Promise<AxiosResponse<T>>; // T修饰返回体data
    interceptors: {
        request: AxiosInterceptorManager<AxiosRequestConfig>;
        response: AxiosInterceptorManager<AxiosResponse>;
    }
    CancelToken: any;
    isCancel: any
}

